]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Use duration 0 when not animating
authorAlessandro Bono <alessandro.bono369@gmail.com>
Sun, 15 Jan 2023 12:18:26 +0000 (13:18 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 31 Oct 2023 22:45:56 +0000 (22:45 +0000)
Instead of using a special branch for the not animate case, just use
the same path with duration 0.

Since commit ee09c5c85312f571e14abe69bb6674a361c16d65 we are sure that
duration 0 is always preserved.

In the not animate case, we now call this._updateState(). This was not
happening before.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2987>
(cherry picked from commit 1571171a21bd8199ddb4da948eb59d622257ca80)

js/ui/messageTray.js

index be9dcbe90b0159ec386850d06789d63ea4ae4af6..73a9ed9f6beac9f8945c708e8aff07d80fb867c0 100644 (file)
@@ -1356,29 +1356,23 @@ export const MessageTray = GObject.registerClass({
         this._resetNotificationLeftTimeout();
         this._bannerBin.remove_all_transitions();
 
-        if (animate) {
-            this._notificationState = State.HIDING;
-            this._bannerBin.ease({
-                opacity: 0,
-                duration: ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_OUT_BACK,
-            });
-            this._bannerBin.ease({
-                y: -this._bannerBin.height,
-                duration: ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_OUT_BACK,
-                onComplete: () => {
-                    this._notificationState = State.HIDDEN;
-                    this._hideNotificationCompleted();
-                    this._updateState();
-                },
-            });
-        } else {
-            this._bannerBin.y = -this._bannerBin.height;
-            this._bannerBin.opacity = 0;
-            this._notificationState = State.HIDDEN;
-            this._hideNotificationCompleted();
-        }
+        const duration = animate ? ANIMATION_TIME : 0;
+        this._notificationState = State.HIDING;
+        this._bannerBin.ease({
+            opacity: 0,
+            duration,
+            mode: Clutter.AnimationMode.EASE_OUT_BACK,
+        });
+        this._bannerBin.ease({
+            y: -this._bannerBin.height,
+            duration,
+            mode: Clutter.AnimationMode.EASE_OUT_BACK,
+            onComplete: () => {
+                this._notificationState = State.HIDDEN;
+                this._hideNotificationCompleted();
+                this._updateState();
+            },
+        });
     }
 
     _hideNotificationCompleted() {